﻿Imports System.Data
Imports System.Data.SqlClient

Public Class frmDoiMatKhau
    Dim da As DataProvider
    Private Sub btnDoiMatKhau_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDoiMatKhau.Click
        If (txtMatKhauCu.Text <> frmMain.strMK) Then
            MsgBox("Mật khẩu không đúng!", MsgBoxStyle.Information, "Thông báo")
            txtMatKhauCu.Focus()
        Else
            da = New DataProvider()

            Dim sql As String = "update TAIKHOAN set PassWord='" + txtMatKhauMoi.Text + "' where UserName ='" + frmMain.strUN + "'"
            da.SqlExcuteNonQuery(sql)
            MsgBox("Đổi mật khẩu thành công", MsgBoxStyle.Information, "Thông báo")
            frmMain.strMK = txtMatKhauMoi.Text
            Me.Close()
            da.CloseConnect()
        End If


    End Sub

    Private Sub btnHuyBo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHuyBo.Click
        Me.Close()
    End Sub
End Class